<template>
	<!--//使用wantch来监听，总会得到一个数值；-->
	<div class="mui-numbox" data-numbox-min="1" :data-numbox-min="max">
		<!-- "-"按钮，点击可减小当前数值 -->
		<button class="mui-btn mui-numbox-btn-minus" type="button">-</button>
		<input class="mui-numbox-input" type="number" value="1" @change="numchange" ref="num" />
		<!-- "+"按钮，点击可增大当前数值 -->
		<button class="mui-btn mui-numbox-btn-plus" type="button">+</button>
	</div>

</template>
<script>
</script>
<script>
	import mui from "../../lib/mui/js/mui.js";
	export default {
		mounted() {
                 console.log(this.max)
			mui(".mui-numbox").numbox();
		},
		methods: {
			numchange() {
				//                  console.log(parseInt(this.$refs.num.value))
				this.$emit("sendballnum", parseInt(this.$refs.num.value));
			}
		},

	props:['max'],
		watch:{
			max: function(newVal,oldVal){
			mui(".mui-numbox").numbox().setOption("max",newVal)
//			
			}
		}

	}
</script>

<style>

</style>